<?php

/*
 * Author: Quan Van Sinh
 * Email: sinhvnb@vietnambiz.com
 */
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Administration</title>
        <link rel="stylesheet" type="text/css" href="/admin/themes/default/css/theme.css" />
        <link rel="stylesheet" type="text/css" href="/admin/themes/default/css/style.css" />
        <link type="text/css" rel="stylesheet" href="/admin/themes/default/js/uploadify/uploadify.css" />
        <script type="text/javascript" src="/admin/themes/default/js/jquery.min.js"></script>

        <?php
        if(($_SESSION['adminActiveMenu']=='article') || ($_SESSION['adminActiveMenu']=='category') ||($_SESSION['adminActiveMenu']=='post_article')||($_SESSION['adminActiveMenu']=='post_question')||($_SESSION['adminActiveMenu']=='comment')||($_SESSION['adminActiveMenu']=='question')) {
            ?>
        <script type="text/javascript" src="/admin/themes/default/js/jquery.MultiFile.pack.js"></script>
        <script type="text/javascript" src="/admin/themes/default/js/datetimepicker_css.js"></script>
        <script type="text/javascript" src="/admin/themes/default/js/thickbox-compressed.js"></script>
        <script type="text/javascript" src="/admin/themes/default/js/common.js"></script>
        <link rel="stylesheet" type="text/css" href="/admin/themes/default/css/thickbox.css" />
        <?php
        }
        ?>

        <script type="text/javascript">
            var ADMIN_SECTION = '<?php echo $config ['admin_section']; ?>';
            var ADMIN_IMAGES_URL = '<?php echo $config ['admin_images_url']; ?>';
            function isValidEmail(str) {
                return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
            }
        </script>
        <!--[if IE]>
            <link rel="stylesheet" type="text/css" href="/admin/themes/default/css/ie-sucks.css" />
        <![endif]-->
    </head>

    <body>
        <div id="container">

            <div id="header">
                <h2>Admin area</h2>
                <?php
                
                $arrCountItem = getCountMenu();
                
                ?>
                <div id="topmenu">
                    <ul>
                        <li <?php echo $_SESSION['adminActiveMenu']=='user'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/user">Users</a></li>
                        <li <?php echo $_SESSION['adminActiveMenu']=='permission'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/permission">Permission</a></li>
                        <li <?php echo $_SESSION['adminActiveMenu']=='category'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/category">Categories</a></li>
                        <li <?php echo $_SESSION['adminActiveMenu']=='article'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/article/1">Articles</a></li>
                        <li <?php echo $_SESSION['adminActiveMenu']=='searchlog'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/searchlog">Search log</a></li>
                        <li <?php echo $_SESSION['adminActiveMenu']=='question'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/question/1">Open Q/A <?php echo $arrCountItem['openq']?'('.$arrCountItem['openq'].')':'(0)'; echo $arrCountItem['open']?'|('.$arrCountItem['opena'].')':'|(0)';?></a></li>
                        <li <?php echo $_SESSION['adminActiveMenu']=='comment'?'class="current"':'';?>><a href="/<?php echo $config ['admin_section']; ?>/comment">Comment<?php if($arrCountItem['comment']>0){echo '('.$arrCountItem['comment'].')';}?></a></li>
                    </ul>
                </div>
            </div>
            <div id="top-panel">
                <div id="panel">
                    <div id="mesageResult"></div>
                    <ul>
                        <li>
                            <?php
                            if(isset($_SESSION['username'])) {
                                echo $_SESSION['username'];
                            }
                            ?>
                        </li>
                        <li>
                            <?php
                            if(isset($_SESSION['username'])) {
                                ?>
                            <a href="/<?php echo $config ['admin_section']; ?>/logout">Logout</a>
                            <?php
                            }
                            ?>
                        </li>
                    </ul>
                </div>
            </div>